import java.sql.*;

public class main {
    public static void main(String[] args)throws Exception{
           try {
               Class.forName("com.mysql.jdbc.Driver");
               Connection conn= DriverManager.getConnection("jdbc:mysql://localhost:3306/school","root","root");
               //创建对象
               Statement stat=conn.createStatement();
               //调用Statment对象的相关方法执行sql语句人后可以对rs中访问出的数据对象进行操作。
               ResultSet rs=stat.executeQuery("select * from sysuser ");
               while (rs.next()){
                   System.out.println("登录名:"+rs.getString("LoginName"));
                   System.out.println("密码:"+rs.getString("LoginPwd"));
               }
               } catch (Exception ex) {
               ex.printStackTrace();
           }

    }
}

